package com.github.captcha.generator.model.dto;

import com.github.captcha.common.constant.CaptchaTypeConstant;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author: haichuan.lu
 * @date 2023/02/23 17:14
 * @Description 验证码类型
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SliderImageCaptcha extends ImageCaptcha {

    /**
     * x轴
     */
    private Integer x;
    /**
     * y轴
     */
    private Integer y;


    public static SliderImageCaptcha of(Integer x, Integer y,
                                        String bgImage,
                                        String sliderImage,
                                        String bgImageTag,
                                        String sliderImageTag,
                                        Integer bgImageWidth,
                                        Integer bgImageHeight,
                                        Integer sliderImageWidth,
                                        Integer sliderImageHeight) {
        SliderImageCaptcha sliderImageCaptcha = new SliderImageCaptcha();
        sliderImageCaptcha.setX(x);
        sliderImageCaptcha.setY(y);
        sliderImageCaptcha.setRandomX(x);
        sliderImageCaptcha.setBgImage(bgImage);
        sliderImageCaptcha.setSliderImage(sliderImage);
        sliderImageCaptcha.setBgImageTag(bgImageTag);
        sliderImageCaptcha.setSliderImageTag(sliderImageTag);
        sliderImageCaptcha.setBgImageWidth(bgImageWidth);
        sliderImageCaptcha.setBgImageHeight(bgImageHeight);
        sliderImageCaptcha.setSliderImageWidth(sliderImageWidth);
        sliderImageCaptcha.setSliderImageHeight(sliderImageHeight);
        sliderImageCaptcha.setType(CaptchaTypeConstant.SLIDER);
        return sliderImageCaptcha;
    }
}
